<?php
namespace app\api\controller;

use app\common\model\Admin;
use think\Controller;

class Auth extends Controller
{
	public function __construct( $request = NULL ) {
		parent::__construct( $request );
		if(Admin::checkLogin()){
			$this->error('already_login');
		}
	}
    public function login()
    {
        $admin=new Admin();
        if($admin->login(input('username'),input('password'))){
        	$this->success('登录成功');
        }else{
        	$this->error($admin->getError());
        }
    }
}
